﻿@using Smartstore.Admin.Models.Common

@model GenericAttributeModel

<datagrid id="generic-attributes-grid" class="h-100"
          allow-resize="true"
          allow-row-selection="true"
          allow-edit="true">
    <datasource read="@Url.Action("GenericAttributesList", "GenericAttribute", new { entityName = Model.EntityName, entityId = Model.AttributeEntityId })"
                delete="@Url.Action("GenericAttributeDelete", "GenericAttribute", new { entityName = Model.EntityName })"
                update="@Url.Action("GenericAttributeUpdate", "GenericAttribute")"
                insert="@Url.Action("GenericAttributeInsert", "GenericAttribute", new { entityName = Model.EntityName, entityId = Model.AttributeEntityId })" />
    <sorting allow-unsort="true" allow-multisort="false">
        <sort by="Key" />
    </sorting>
    <paging enabled="true" />
    <toolbar>
        <toolbar-group>
            <button datagrid-action="DataGridToolAction.InsertRow" type="button" class="btn btn-primary btn-flat no-anims mr-auto">
                <i class="fa fa-plus"></i>
                <span>@T("Admin.Common.AddNew")</span>
            </button>
            <button datagrid-action="DataGridToolAction.SaveChanges" type="button" class="btn btn-warning no-anims btn-flat">
                <i class="fa fa-check"></i>
                <span>@T("Admin.Common.SaveChanges")</span>
            </button>
            <button datagrid-action="DataGridToolAction.CancelEdit" type="button" class="btn btn-light btn-flat mr-auto">
                <span>@T("Common.Cancel")</span>
            </button>
        </toolbar-group>
        <zone name="datagrid_toolbar_alpha"></zone>
        <toolbar-group class="omega"></toolbar-group>
        <zone name="datagrid_toolbar_omega"></zone>
        <toolbar-group>
            <button datagrid-action="DataGridToolAction.DeleteSelectedRows" type="button" class="btn btn-danger no-anims btn-flat">
                <i class="far fa-trash-can"></i>
                <span>@T("Admin.Common.Delete.Selected")</span>
            </button>
        </toolbar-group>
    </toolbar>
    <columns>
        <column for="Key" width="400px" hideable="false" />
        <column for="Value" hideable="false" />
    </columns>
    <row-commands>
        <a datarow-action="DataRowAction.InlineEdit">@T("Common.Edit")</a>
        <a datarow-action="DataRowAction.Delete">@T("Common.Delete")</a>
    </row-commands>
</datagrid>